package com.csea.demo.service.serviceImpl;

import com.csea.demo.pojo.FoodEntity;
import com.csea.demo.mapper.FoodMapper;
import com.csea.demo.service.FoodService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Csea
 * @since 2020-02-26
 */
@Service
@Slf4j
public class FoodServiceImpl extends ServiceImpl<FoodMapper, FoodEntity> implements FoodService {
    @Resource
    private FoodMapper foodMapper;

    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public void add(FoodEntity foodEntity) {
        foodMapper.insert(foodEntity);
    }

    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public void addS(FoodEntity foodEntity) {
        foodMapper.insert(foodEntity);
    }

    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public void addM(FoodEntity foodEntity) {
        foodMapper.insert(foodEntity);
    }


    @Override
    public void addNew(FoodEntity foodEntity) {
        log.info("value={}", 1 / 0);
        foodMapper.insert(foodEntity);
    }

    @Override
    public void addd(FoodEntity foodEntity) {

        foodMapper.insert(foodEntity);
    }
}
